home *** CD-ROM | disk | FTP | other *** search
- Path: news.cc.sunysb.edu!math!stefan
- From: stefan@math.sunysb.edu (Stefan Gromoll)
- Newsgroups: comp.lang.c++
- Subject: Re: Arrow keys in DOS
- Date: 22 Feb 1996 16:29:35 GMT
- Organization: SUNY at Stony Brook, Dept. of Math
- Message-ID: <4gi5lf$omn@abel.cc.sunysb.edu>
- References: <312A7CDB.7010@wolfenet.com>
- NNTP-Posting-Host: math-gw.pi.sunysb.edu
-
- In article <312A7CDB.7010@wolfenet.com> Michael Gooding <mgooding@wolfenet.com> writes:
- >How would one go about trapping and interpreting arrow keys in a DOS
- >program written in BC++ 4.5
-
-
- Michael,
-
- each arrow key sends two values- the first signifies an extended key,
- and the second signifies the key itself. I think the secondary values
- of the keys are like 70-74 or so. You can write a simple program to
- find these out:
-
- main()
- {
-
- int first, second;
-
- first = getch(); // in conio.h i think?
- second = getch();
-
- cout << "Extended character value: " << first << endl;
- cout << "Value for arrow key: " << second << endl;
- }
-
-
- Its rough code, but something like that should work. So when you're
- testing input and find the extended character value, just use another
- getchar to get the value of the arrow key, and then test that.
-
- I hope my explanation hasn't been too confusing {:)
-
- -stefan
-
- --
- stefan@math.sunysb.edu
-